﻿<%
Sa.Extends("connAction")
Class newsAction
	'''新闻列表
	Public Sub index()
		'使用分页
		Sa.Dim("S_desc")
		'使用语言包可以进行多语定义
		S_desc = L_newsdesc
		'此时测试单行多命令格式化
		Sa.Dim("S_kwd") : S_kwd = L_newskwd
		Sa.Dim("S_author") : S_author = L_newsauthor
		'Sa.Use("Db")
		'Db.Conn = Db.OpenConn(1,Sa.Config("AccessPath"),Sa.Config("AccessPwd"))
		Sa.Use("Pager")
		Call Pager.Set("first", "<a href=""{url}"">首页</a>")
		Call Pager.Set("prev", "<a href=""{url}"">上一页</a>")
		Call Pager.Set("next", "<a href=""{url}"">下一页</a>")
		Call Pager.Set("last", "<a href=""{url}"">尾页</a>")
		Call Pager.Set("nmod", "<span>{page}&nbsp;</span>")
		Call Pager.Set("amod", "<a href=""{url}"">{page}</a>")
		Pager.Model = "{first}{prev}{list}{next}{last}"&vbcrlf&"跳转到&nbsp;"&vbcrlf&"{jump}&nbsp;页"&vbcrlf&"{button}"
		Pager.PageNow = G(Pager.PageVar&":n:1")
		Call Pager.AddPara("m", "news")
		Pager.FormatUrlFun = "U({0},4)"
		'pager.TargetPage = "/?m=news"
		'Pager.ShowPageNowA = False
		'pager.ALeftExt = "<span>"
		'pager.ARightExt = "</span>"
		'Pager.NLeftExt = "<span>"
		'Pager.NRightExt = "</span>"
		'Call pager.AddAOtherTaginfo("style='color:green;'")
		'Call pager.AddNOtherTaginfo("style='color:red;'")
		'pager.FormatUrlFun = "DefaultURL({0},3)"
		'Response.Write(3)
		'Response.Flush
		Call Sa.DimObject("rsnme")
		'Db.Conn = Db.OpenConn(1,"/data/##db##/##mdb.mdb","123456")
		'Response.Write(Core.Config("AccessPath") & Core.Config("AccessPwd") & ";llll")
		'Response.Flush
		'Db.Conn = Db.OpenConn(1,Core.Config("AccessPath"),Core.Config("AccessPwd"))
		'Response.Write(Core.Config("AccessPath") & Core.Config("AccessPwd") & ";llll")
		'Response.Flush
		Set rsnme = Db.GR("News:id,title,editor,Addtime,cid,content","","px Desc")
		'Response.Write(4)
		'Response.Flush
		Pager.FormatRs(rsnme)
		'Response.Write(5)
		'Response.Flush
		Call Sa.show()
	End Sub
	
	'''新闻内容
	Public Sub read()
		'HTML缓存当前页面
		Sa.HTML = True
		Dim newsid : newsid = G("id:n:0")
		Sa.Dim("S_desc")
		'使用语言包可以进行多语定义
		S_desc = L_newsdesc
		Sa.Dim("S_kwd")
		S_kwd = L_newskwd
		Sa.Dim("S_author")
		S_author = L_newsauthor
		Sa.Dim("newsTitle")
		Sa.Dim("newsContent")
		Sa.Dim("newsAddtime")
		Sa.Dim("hasnews")
		'Db.Conn = Db.OpenConn(1,"/data/##db##/##mdb.mdb","123456")
		'Sa.Use("Db")
		'Db.Conn = Db.OpenConn(1,Sa.Config("AccessPath"),Sa.Config("AccessPwd"))
		Dim rs : Set rs = Db.GetRecordDetail("News","id="&newsid)
		If rs.Recordcount<>1 Then
			hasnews = False
		Else
			hasnews = True
			S_desc = S_desc & rs("title")
			S_author = S_author & newsid
			S_kwd = S_kwd & rs("title")
			newsTitle = rs("title")
			newsContent = rs("content")
			newsAddtime = rs("Addtime")
		End If
		Db.C(rs)
		Set rs = Nothing
		Sa.show
	End Sub
	
	'''前10条，测试foreach标签
	Public Sub top()
		Sa.DimObject("rsnme")
		'Set rsnme = Db.GR("Wygkcnhtml_News:ID,NewsNameCh,ContentCh,AddTime,ClickNumber:10","","ID Asc")
		Set rsnme = Db.GR("News:id,title,editor,Addtime,cid:10","","px Desc")
		Call Sa.show
	End Sub
End Class
%>